package com.enation.app.shop.front.policyInsurance.webController;

import com.enation.app.shop.core.goods.model.Cat;
import com.enation.app.shop.core.goods.service.impl.GoodsCatManager;
import com.enation.app.shop.front.api.utils.Json;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Scope("prototype")
@Controller
@RequestMapping("web/inpolicyCat")
public class InPolicyCatController {
    @Autowired
    private GoodsCatManager goodsCat;


    @RequestMapping("/getTwoCat")
    @ResponseBody
    public Json getgetTwoCat(Integer id){
        List<Cat> catList=goodsCat.listChildren(id);
        if (catList!=null){
            return new Json(true,"success",catList);
        } else {
            return new Json(false,"fail",null);
        }
    }
}
